﻿#region Usings

using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading;
using System.Web.Services;
using System.Web.Services.Description;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
using Rail.Net.Properties;

#endregion

#pragma warning disable 1591

namespace Rail.Net.KontengentVerfuegung
{
    /// <remarks />
    [GeneratedCode("System.Web.Services", "4.0.30319.1")]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [WebServiceBinding(Name = "KONTINGENTVERFUEGUNGBinding", Namespace = "urn:KONTINGENTVERFUEGUNG-interface")]
    public class KONTINGENTVERFUEGUNGService : SoapHttpClientProtocol
    {
        private SendOrPostCallback KONTINGENTVERFUEGUNGOperationCompleted;

        private bool useDefaultCredentialsSetExplicitly;

        /// <remarks />
        public KONTINGENTVERFUEGUNGService()
        {
            Url = Settings.Default.Rail_Net_KontengentVerfuegung_KONTINGENTVERFUEGUNGService;
            if (IsLocalFileSystemWebService(Url))
            {
                UseDefaultCredentials = true;
                useDefaultCredentialsSetExplicitly = false;
            }
            else
            {
                useDefaultCredentialsSetExplicitly = true;
            }
        }

        public Session SessionValue { get; set; }

        public Encoding EncodingValue { get; set; }

        public new string Url
        {
            get { return base.Url; }
            set
            {
                if (((IsLocalFileSystemWebService(base.Url)
                      && (useDefaultCredentialsSetExplicitly == false))
                     && (IsLocalFileSystemWebService(value) == false)))
                {
                    base.UseDefaultCredentials = false;
                }
                base.Url = value;
            }
        }

        public new bool UseDefaultCredentials
        {
            get { return base.UseDefaultCredentials; }
            set
            {
                base.UseDefaultCredentials = value;
                useDefaultCredentialsSetExplicitly = true;
            }
        }

        /// <remarks />
        public event KONTINGENTVERFUEGUNGCompletedEventHandler KONTINGENTVERFUEGUNGCompleted;

        /// <remarks />
        [SoapHeader("SessionValue", Direction = SoapHeaderDirection.InOut)]
        [SoapHeader("EncodingValue")]
        [SoapDocumentMethod("KONTINGENTVERFUEGUNG", Use = SoapBindingUse.Literal,
            ParameterStyle = SoapParameterStyle.Bare)]
        [return: XmlElement("KONTINGENTVERFUEGUNGResponse0", Namespace = "urn:cpq_tns_KONTINGENTVERFUEGUNG")]
        public KONTINGENTVERFUEGUNGResponse0 KONTINGENTVERFUEGUNG(
            [XmlElement("KONTINGENTVERFUEGUNG", Namespace = "urn:cpq_tns_KONTINGENTVERFUEGUNG")] KONTINGENTVERFUEGUNG
                KONTINGENTVERFUEGUNG1)
        {
            var results = Invoke("KONTINGENTVERFUEGUNG", new object[]
                                                             {
                                                                 KONTINGENTVERFUEGUNG1
                                                             });
            return ((KONTINGENTVERFUEGUNGResponse0) (results[0]));
        }

        /// <remarks />
        public void KONTINGENTVERFUEGUNGAsync(KONTINGENTVERFUEGUNG KONTINGENTVERFUEGUNG1)
        {
            KONTINGENTVERFUEGUNGAsync(KONTINGENTVERFUEGUNG1, null);
        }

        /// <remarks />
        public void KONTINGENTVERFUEGUNGAsync(KONTINGENTVERFUEGUNG KONTINGENTVERFUEGUNG1, object userState)
        {
            if ((KONTINGENTVERFUEGUNGOperationCompleted == null))
            {
                KONTINGENTVERFUEGUNGOperationCompleted = new SendOrPostCallback(OnKONTINGENTVERFUEGUNGOperationCompleted);
            }
            InvokeAsync("KONTINGENTVERFUEGUNG", new object[]
                                                    {
                                                        KONTINGENTVERFUEGUNG1
                                                    }, KONTINGENTVERFUEGUNGOperationCompleted, userState);
        }

        private void OnKONTINGENTVERFUEGUNGOperationCompleted(object arg)
        {
            if ((KONTINGENTVERFUEGUNGCompleted != null))
            {
                var invokeArgs = ((InvokeCompletedEventArgs) (arg));
                KONTINGENTVERFUEGUNGCompleted(this,
                                              new KONTINGENTVERFUEGUNGCompletedEventArgs(invokeArgs.Results,
                                                                                         invokeArgs.Error,
                                                                                         invokeArgs.Cancelled,
                                                                                         invokeArgs.UserState));
            }
        }

        /// <remarks />
        public new void CancelAsync(object userState)
        {
            base.CancelAsync(userState);
        }

        private bool IsLocalFileSystemWebService(string url)
        {
            if (((url == null)
                 || (url == string.Empty)))
            {
                return false;
            }
            var wsUri = new Uri(url);
            if (((wsUri.Port >= 1024)
                 && (string.Compare(wsUri.Host, "localHost", StringComparison.OrdinalIgnoreCase) == 0)))
            {
                return true;
            }
            return false;
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(AnonymousType = true, Namespace = "urn:compaq_nsk_oss_SoapHeader")]
    [XmlRoot(Namespace = "urn:compaq_nsk_oss_SoapHeader", IsNullable = false)]
    public class Session : SoapHeader
    {
        private string beginNewTransactionField;

        private string currentTransactionCommandField;

        private string sessionCommandField;
        private string sessionIDField;

        private string subsessionField;

        /// <remarks />
        [XmlAttribute]
        public string SessionID
        {
            get { return sessionIDField; }
            set { sessionIDField = value; }
        }

        /// <remarks />
        [XmlAttribute]
        public string BeginNewTransaction
        {
            get { return beginNewTransactionField; }
            set { beginNewTransactionField = value; }
        }

        /// <remarks />
        [XmlAttribute]
        public string CurrentTransactionCommand
        {
            get { return currentTransactionCommandField; }
            set { currentTransactionCommandField = value; }
        }

        /// <remarks />
        [XmlAttribute]
        public string SessionCommand
        {
            get { return sessionCommandField; }
            set { sessionCommandField = value; }
        }

        /// <remarks />
        [XmlAttribute]
        public string Subsession
        {
            get { return subsessionField; }
            set { subsessionField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTVERFUEGUNG")]
    public class as_ktg
    {
        private string anz_pl_freiField;
        private string datumField;
        private string fillerField;
        private string ktg_sub_nrField;

        private string pers_artField;

        private string preis_plField;
        private string wklField;

        private string zug_katField;
        private string zug_nrField;

        /// <remarks />
        public string datum
        {
            get { return datumField; }
            set { datumField = value; }
        }

        /// <remarks />
        public string zug_nr
        {
            get { return zug_nrField; }
            set { zug_nrField = value; }
        }

        /// <remarks />
        public string wkl
        {
            get { return wklField; }
            set { wklField = value; }
        }

        /// <remarks />
        public string zug_kat
        {
            get { return zug_katField; }
            set { zug_katField = value; }
        }

        /// <remarks />
        public string pers_art
        {
            get { return pers_artField; }
            set { pers_artField = value; }
        }

        /// <remarks />
        public string preis_pl
        {
            get { return preis_plField; }
            set { preis_plField = value; }
        }

        /// <remarks />
        public string anz_pl_frei
        {
            get { return anz_pl_freiField; }
            set { anz_pl_freiField = value; }
        }

        /// <remarks />
        public string ktg_sub_nr
        {
            get { return ktg_sub_nrField; }
            set { ktg_sub_nrField = value; }
        }

        /// <remarks />
        public string filler
        {
            get { return fillerField; }
            set { fillerField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTVERFUEGUNG")]
    public class request
    {
        private string anz_sub_ktgField;
        private as_ktg[] as_ktgField;
        private string fillerField;
        private string flag_kz_hinField;
        private string flag_kz_preisField;
        private string flag_kz_rueckField;
        private string ktg_nrField;

        private string ref_nr_ktg_vField;

        private string ttl_stdnField;
        private string ttl_tageField;

        /// <remarks />
        public string ktg_nr
        {
            get { return ktg_nrField; }
            set { ktg_nrField = value; }
        }

        /// <remarks />
        public string ref_nr_ktg_v
        {
            get { return ref_nr_ktg_vField; }
            set { ref_nr_ktg_vField = value; }
        }

        /// <remarks />
        public string ttl_tage
        {
            get { return ttl_tageField; }
            set { ttl_tageField = value; }
        }

        /// <remarks />
        public string ttl_stdn
        {
            get { return ttl_stdnField; }
            set { ttl_stdnField = value; }
        }

        /// <remarks />
        public string flag_kz_hin
        {
            get { return flag_kz_hinField; }
            set { flag_kz_hinField = value; }
        }

        /// <remarks />
        public string flag_kz_rueck
        {
            get { return flag_kz_rueckField; }
            set { flag_kz_rueckField = value; }
        }

        /// <remarks />
        public string flag_kz_preis
        {
            get { return flag_kz_preisField; }
            set { flag_kz_preisField = value; }
        }

        /// <remarks />
        public string anz_sub_ktg
        {
            get { return anz_sub_ktgField; }
            set { anz_sub_ktgField = value; }
        }

        /// <remarks />
        public string filler
        {
            get { return fillerField; }
            set { fillerField = value; }
        }

        /// <remarks />
        [XmlElement("as_ktg")]
        public as_ktg[] as_ktg
        {
            get { return as_ktgField; }
            set { as_ktgField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTVERFUEGUNG")]
    public class header
    {
        private short lenheaderField;

        private short lenreplyField;
        private uint servicekeyField;

        private int value_serviceField;

        /// <remarks />
        public uint servicekey
        {
            get { return servicekeyField; }
            set { servicekeyField = value; }
        }

        /// <remarks />
        public int value_service
        {
            get { return value_serviceField; }
            set { value_serviceField = value; }
        }

        /// <remarks />
        public short lenheader
        {
            get { return lenheaderField; }
            set { lenheaderField = value; }
        }

        /// <remarks />
        public short lenreply
        {
            get { return lenreplyField; }
            set { lenreplyField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTVERFUEGUNG")]
    public class KONTINGENTVERFUEGUNGResponse0
    {
        private header headerField;

        private request requestField;

        /// <remarks />
        public header header
        {
            get { return headerField; }
            set { headerField = value; }
        }

        /// <remarks />
        public request request
        {
            get { return requestField; }
            set { requestField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTVERFUEGUNG")]
    public class as_pers_anz
    {
        private string anzahlField;

        private string fillerField;
        private string pers_artField;

        /// <remarks />
        public string pers_art
        {
            get { return pers_artField; }
            set { pers_artField = value; }
        }

        /// <remarks />
        public string anzahl
        {
            get { return anzahlField; }
            set { anzahlField = value; }
        }

        /// <remarks />
        public string filler
        {
            get { return fillerField; }
            set { fillerField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTVERFUEGUNG")]
    public class request_7_0
    {
        private string abf_hField;

        private string abf_rField;
        private string appField;
        private as_pers_anz[] as_pers_anzField;
        private string[] dat_hField;

        private string[] dat_rField;
        private string dl_kontiField;
        private string[] entf_hField;

        private string[] entf_rField;

        private string grbf_hField;

        private string grbf_rField;
        private string kassaField;
        private string ktg_nrField;
        private string kz_fpl_gest_vkField;
        private string kz_richtung_hField;

        private string kz_richtung_rField;

        private string rel_hField;

        private string rel_rField;

        private string rt_pnrField;

        private string servField;
        private string termbfField;

        private string v_kanalField;
        private string v_sysField;
        private string[] vw_hField;

        private string[] vw_rField;
        private string wkl_hField;

        private string wkl_rField;
        private string zbf_hField;

        private string zbf_rField;
        private string zeit_hField;

        private string zeit_rField;

        private string[] zug_hField;
        private string zug_kat_hField;

        private string zug_kat_rField;
        private string[] zug_rField;

        /// <remarks />
        public string dl_konti
        {
            get { return dl_kontiField; }
            set { dl_kontiField = value; }
        }

        /// <remarks />
        public string ktg_nr
        {
            get { return ktg_nrField; }
            set { ktg_nrField = value; }
        }

        /// <remarks />
        [XmlElement("dat_h")]
        public string[] dat_h
        {
            get { return dat_hField; }
            set { dat_hField = value; }
        }

        /// <remarks />
        [XmlElement("dat_r")]
        public string[] dat_r
        {
            get { return dat_rField; }
            set { dat_rField = value; }
        }

        /// <remarks />
        public string zeit_h
        {
            get { return zeit_hField; }
            set { zeit_hField = value; }
        }

        /// <remarks />
        public string zeit_r
        {
            get { return zeit_rField; }
            set { zeit_rField = value; }
        }

        /// <remarks />
        [XmlElement("zug_h")]
        public string[] zug_h
        {
            get { return zug_hField; }
            set { zug_hField = value; }
        }

        /// <remarks />
        [XmlElement("zug_r")]
        public string[] zug_r
        {
            get { return zug_rField; }
            set { zug_rField = value; }
        }

        /// <remarks />
        public string zug_kat_h
        {
            get { return zug_kat_hField; }
            set { zug_kat_hField = value; }
        }

        /// <remarks />
        public string zug_kat_r
        {
            get { return zug_kat_rField; }
            set { zug_kat_rField = value; }
        }

        /// <remarks />
        public string kz_richtung_h
        {
            get { return kz_richtung_hField; }
            set { kz_richtung_hField = value; }
        }

        /// <remarks />
        public string kz_richtung_r
        {
            get { return kz_richtung_rField; }
            set { kz_richtung_rField = value; }
        }

        /// <remarks />
        public string wkl_h
        {
            get { return wkl_hField; }
            set { wkl_hField = value; }
        }

        /// <remarks />
        public string wkl_r
        {
            get { return wkl_rField; }
            set { wkl_rField = value; }
        }

        /// <remarks />
        public string abf_h
        {
            get { return abf_hField; }
            set { abf_hField = value; }
        }

        /// <remarks />
        public string abf_r
        {
            get { return abf_rField; }
            set { abf_rField = value; }
        }

        /// <remarks />
        public string zbf_h
        {
            get { return zbf_hField; }
            set { zbf_hField = value; }
        }

        /// <remarks />
        public string zbf_r
        {
            get { return zbf_rField; }
            set { zbf_rField = value; }
        }

        /// <remarks />
        public string grbf_h
        {
            get { return grbf_hField; }
            set { grbf_hField = value; }
        }

        /// <remarks />
        public string grbf_r
        {
            get { return grbf_rField; }
            set { grbf_rField = value; }
        }

        /// <remarks />
        public string rel_h
        {
            get { return rel_hField; }
            set { rel_hField = value; }
        }

        /// <remarks />
        public string rel_r
        {
            get { return rel_rField; }
            set { rel_rField = value; }
        }

        /// <remarks />
        [XmlElement("vw_h")]
        public string[] vw_h
        {
            get { return vw_hField; }
            set { vw_hField = value; }
        }

        /// <remarks />
        [XmlElement("vw_r")]
        public string[] vw_r
        {
            get { return vw_rField; }
            set { vw_rField = value; }
        }

        /// <remarks />
        [XmlElement("entf_h")]
        public string[] entf_h
        {
            get { return entf_hField; }
            set { entf_hField = value; }
        }

        /// <remarks />
        [XmlElement("entf_r")]
        public string[] entf_r
        {
            get { return entf_rField; }
            set { entf_rField = value; }
        }

        /// <remarks />
        [XmlElement("as_pers_anz")]
        public as_pers_anz[] as_pers_anz
        {
            get { return as_pers_anzField; }
            set { as_pers_anzField = value; }
        }

        /// <remarks />
        public string kz_fpl_gest_vk
        {
            get { return kz_fpl_gest_vkField; }
            set { kz_fpl_gest_vkField = value; }
        }

        /// <remarks />
        public string rt_pnr
        {
            get { return rt_pnrField; }
            set { rt_pnrField = value; }
        }

        /// <remarks />
        public string termbf
        {
            get { return termbfField; }
            set { termbfField = value; }
        }

        /// <remarks />
        public string app
        {
            get { return appField; }
            set { appField = value; }
        }

        /// <remarks />
        public string kassa
        {
            get { return kassaField; }
            set { kassaField = value; }
        }

        /// <remarks />
        public string serv
        {
            get { return servField; }
            set { servField = value; }
        }

        /// <remarks />
        public string v_sys
        {
            get { return v_sysField; }
            set { v_sysField = value; }
        }

        /// <remarks />
        public string v_kanal
        {
            get { return v_kanalField; }
            set { v_kanalField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTVERFUEGUNG")]
    public class header_1_0
    {
        private short endheadField;
        private short lenbufField;
        private short lenheaderField;

        private short maxreplyField;
        private uint servicekeyField;

        /// <remarks />
        public uint servicekey
        {
            get { return servicekeyField; }
            set { servicekeyField = value; }
        }

        /// <remarks />
        public short lenheader
        {
            get { return lenheaderField; }
            set { lenheaderField = value; }
        }

        /// <remarks />
        public short lenbuf
        {
            get { return lenbufField; }
            set { lenbufField = value; }
        }

        /// <remarks />
        public short maxreply
        {
            get { return maxreplyField; }
            set { maxreplyField = value; }
        }

        /// <remarks />
        public short endhead
        {
            get { return endheadField; }
            set { endheadField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(Namespace = "urn:cpq_tns_KONTINGENTVERFUEGUNG")]
    public class KONTINGENTVERFUEGUNG
    {
        private header_1_0 headerField;

        private request_7_0 requestField;

        /// <remarks />
        public header_1_0 header
        {
            get { return headerField; }
            set { headerField = value; }
        }

        /// <remarks />
        public request_7_0 request
        {
            get { return requestField; }
            set { requestField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Xml", "4.0.30319.1")]
    [Serializable]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [XmlType(AnonymousType = true, Namespace = "urn:compaq_nsk_oss_SoapHeader")]
    [XmlRoot(Namespace = "urn:compaq_nsk_oss_SoapHeader", IsNullable = false)]
    public class Encoding : SoapHeader
    {
        private string outputEncodingField;

        /// <remarks />
        [XmlAttribute]
        public string OutputEncoding
        {
            get { return outputEncodingField; }
            set { outputEncodingField = value; }
        }
    }

    /// <remarks />
    [GeneratedCode("System.Web.Services", "4.0.30319.1")]
    public delegate void KONTINGENTVERFUEGUNGCompletedEventHandler(
        object sender, KONTINGENTVERFUEGUNGCompletedEventArgs e);

    /// <remarks />
    [GeneratedCode("System.Web.Services", "4.0.30319.1")]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    public class KONTINGENTVERFUEGUNGCompletedEventArgs : AsyncCompletedEventArgs
    {
        private readonly object[] results;

        internal KONTINGENTVERFUEGUNGCompletedEventArgs(object[] results, Exception exception, bool cancelled,
                                                        object userState) :
                                                            base(exception, cancelled, userState)
        {
            this.results = results;
        }

        /// <remarks />
        public KONTINGENTVERFUEGUNGResponse0 Result
        {
            get
            {
                RaiseExceptionIfNecessary();
                return ((KONTINGENTVERFUEGUNGResponse0) (results[0]));
            }
        }
    }
}

#pragma warning restore 1591